package com.kfm.jdbc.day0329;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.Arrays;

public class Demo03 {

    public static void main(String[] args) {
        try (FileInputStream fis = new FileInputStream("d:\\io\\test.txt")) {
            byte[] bytes = new byte[10];
//            int length = -1;
//            // 读取文件的内容
//            while ((length = fis.read(bytes)) != -1) {
//                System.out.print(new String(bytes, 0, length));
//            }

            byte[] bytes1 = fis.readAllBytes();
            System.out.println(new String(bytes1));
        } catch (FileNotFoundException ex) {
            throw new RuntimeException(ex);
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }
    }
}
